function editcommit() {
    if (!input.text) {
        dialog.message("测试内容不能为空")
        return
    }

    nav.initializeTask(0, 2, "正在添加测试项....")
    nav.openTask("测试项")
    http.put("/test.json", {id: mwindow.itemid}, {
                 member: {id:usinfo.id, display: usinfo.name},

                 content: input.text
             }, function(json) {
                 nav.value = nav.maximumValue

                 if (json.error){
                     dialog.message(json.error.description)
                 }
                 else {
                     dialog.toast("编辑成功")
                     xmlModel.reload()
                 }
             }
             )
}


function addcommit() {
    if (!input.text) {
        dialog.message("测试内容不能为空")
        return
    }

    nav.initializeTask(0, 2, "正在添加测试项....")
    nav.openTask("测试项")
    http.post("/test.json", {}, {
                  member: {id:usinfo.id, display: usinfo.name},

                  content: input.text
              }, function(json) {
                  nav.value = nav.maximumValue

                  if (json.error){
                      dialog.message(json.error.description)
                  }
                  else {
                      dialog.toast("添加成功")
                      xmlModel.reload()
                  }
              }
              )
}


function edit(content) {
    input.editable = true
mwindow.close()
    input.open()

}

function del(){
    http.del("/test.json", {id: mwindow.itemid}, function(json) {

        if (json.error){
            dialog.message(json.error.description)
        }
        else {
            dialog.toast("删除成功")
            xmlModel.reload()
        }
    }
    )

    mwindow.close()
}
